package com.im.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.im.app.model.Doyuming;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 域名列表Mapper接口
 *
 * @author aaa
 * @date 2023-04-12
 */
public interface DoyumingMapper extends BaseMapper<Doyuming> {
    @Select("select * from doyuming where leixing = #{leixing} and status=2 and fenpeicount < max_use_count order by id asc limit 1 ")
    Doyuming selectDoyumingBYOne(@Param("leixing") String leixing);

    @Select("select * from doyuming where leixing = #{leixing} and is_use = 0 and status=2 limit 1")
    Doyuming selectDlDoyumingBYOne(@Param("leixing") String leixing);

    @Select("select * from doyuming where status=2 and domain=#{domain}")
    Doyuming selectDoyumingByDomain(@Param("domain") String domain);

    @Select("select * from doyuming where leixing=10 and is_use = 1 and status = 2 limit 1")
    Doyuming selectDoyumingType10();

    @Select("select * from doyuming where leixing = #{leixing}  and status=2 and fenpeicount < 3 order by id asc limit 1")
    Doyuming selectDoyumingByRandom(@Param("leixing") String leixing);

    @Select("select * from doyuming where leixing = 10 and status=2 and fenpeicount < max_use_count and domain != #{domain} limit 1")
    Doyuming selectDoyumingBYOne1(@Param("domain") String domain);

}
